/*
Cache.h
*/

#ifndef Cache_h
#define Cache_h

#include <map>
#include <list>
#include "Settings.h"

using namespace std;

class FileSystem;
class DataBlock;

class Cache{
    public:
        Cache(FileSystem * fs_loc);
        ~Cache();
        DataBlock * GetDataBlock(unsigned int block_id);
    private:
        FileSystem * fs;
        map <unsigned int, DataBlock *> blocks; //index = block_id
        list < DataBlock* > lru_list; //first item in this list is the lru block
        unsigned int max_map_size; //maximum number of blocks that can be in the cache (10MB / BlockSize)
};

#endif
